package com.zhangsl.listener;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import com.zhangsl.vo.UserVO;


public class SessionListener implements HttpSessionListener{
	public static Map<Long, String> LOGIN_USER_MAP = new HashMap<Long, String>();//登入用户
	public static Map<Long, String> LOGOUT_USER_MAP = new HashMap<Long, String>();//逼下线用户
	//session创建
	public void sessionCreated(HttpSessionEvent event) {
	}
	//session销毁
	public void sessionDestroyed(HttpSessionEvent event) {
		HttpSession session = event.getSession();
		UserVO user = (UserVO) session.getAttribute("");
		if(user != null){
			LOGIN_USER_MAP.remove(user.getId());
		}
	}
}
